import request from '@/utils/request'


export default {

    //获取错题本
    getWrongBook(uid,page,size){
        return request({
            url:`/paper/wrong/${page}/${size}`,
            method:'get',
            params:{uid:uid},
        })
    },

    //新增错题本
    addWrongBook(uid,sid){
        return request({
            url:`/paper/wrong`,
            method:'post',
            params:{uid:uid,sid:sid},
        })
    },

    //新增试卷
    add(exam,id){
        return request({
            url:`/paper/exam/user/${id}`,
            method:'post',
            data:exam,
        })
    },

    queryPaperById(id){
        return request({ 
            url:`/paper/exam/${id}`,
            method:'get',
        })
    },

    getuserPaperList(page,size,id){
        return request({
            url: `/paper/exam/pagelist/${page}/${size}`,
            method: 'get',
            params:{id:id}
        })
    },

    search(page,size,cid){ //根据分类查找试卷
        return request(
            {
                url:`paper/exam/searchlist/${page}/${size}/${cid}`,
                method:'get',
            }
        )        
    },

    getExam(id){
        return request({
            url: `paper/exam/${id}`,
            method: 'get',
        })
    },

    getIntroduce(pid){
        return request({
            url: `paper/exam/${pid}`,
            method: 'get',
        })
    },


    getPaperList(page,size){
        return request({
            url: `/paper/exam/pagelist/${page}/${size}`,
            method: 'get',
        })
    },

    getCascader(){
        return request({
            url: `/paper/category/cascader`,
            method: 'get',
        })
    },

    subResult(answerList,pId,testId,userId){
        return request({
            url: `/paper/exam/evaluation`,
            method: 'post',
            data:{"pId":pId,"answerList":answerList,"testId":testId,"userId":userId},
            
        })
    }
}